package com.example.demo.future;

import org.apache.tomcat.util.threads.ThreadPoolExecutor;

import java.util.concurrent.*;

public class FutureTest {

    //https://www.cnblogs.com/ludongguoa/p/15316488.html
    private static Executor executor = new ThreadPoolExecutor(1, 1, 0, TimeUnit.MILLISECONDS, new ArrayBlockingQueue<>(10));

    public static void main(String[] args) throws ExecutionException, InterruptedException {

        CompletableFuture<UserInfo> completableFuture = CompletableFuture.supplyAsync(UserInfo::new, executor);

        Object o = completableFuture.get();

        System.out.println(o.toString());

    }
}
